// 游戏开始界面，包括背景、进入游戏、登录、设置
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

import 'game1/game1.dart';

class GameEntry extends StatefulWidget {
  const GameEntry({Key? key}) : super(key: key);

  @override
  _GameEntryState createState() => _GameEntryState();
}

class _GameEntryState extends State<GameEntry> {
  @override
  void initState() {
    super.initState();
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeLeft, //全屏时旋转方向，左边
    ]);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
          decoration: BoxDecoration(
              image: DecorationImage(
                  fit: BoxFit.cover,
                  image: NetworkImage(
                      'http://pic.87g.com/upload/2020/0321/20200321094532242.jpg'))),
          child: Stack(
            children: [
              Positioned(
                  right: 20,
                  top: 20,
                  child: IconButton(
                    icon: Icon(Icons.settings),
                    color: Colors.grey,
                    onPressed: () {},
                  )),
              Center(
                child: ElevatedButton(
                    onPressed: () {
                      Navigator.push(context, MaterialPageRoute(builder: (_) {
                        return Game1();
                        // GameCenter
                      }));
                    },
                    child: Text('进入游戏')),
              )
            ],
          )),
    );
  }
}
